package groups;

import user.User;


/**
 *
 * @author Thorsten Ludwig
 */
public class ExerciseGroupContainer {
    
    private ExerciseGroup eg;
    private String tempLeader;
    private boolean isLeaderValid;
    
    public ExerciseGroupContainer(ExerciseGroup eg) {
        this.eg = eg;
        this.isLeaderValid = true;
    }

    public ExerciseGroup getEg() {
        return eg;
    }

    public void setEg(ExerciseGroup eg) {
        this.eg = eg;
    }

    public String getTempLeader() {
        return tempLeader;
    }

    public void setTempLeader(String tempLeader) {
        this.tempLeader = tempLeader;
    }
    
    public void addLeader(String leader) {
        this.isLeaderValid = this.eg.addLeader(leader);
    }

    public boolean isIsLeaderValid() {
        return isLeaderValid;
    }

    public void setIsLeaderValid(boolean isLeaderValid) {
        this.isLeaderValid = isLeaderValid;
    }
    
    public void generateGroupName() {
        String neuerName;
        String u = "" ;
        if (this.eg.getLeaders().size() > 0) {
            u = this.eg.getLeaders().get(0);
        }
        String ort = this.eg.getPlace();
        String zeit="";
        if (this.eg.getTime() != null) 
            zeit = this.eg.getTime().toString();        
        neuerName = zeit + " " + ort + " " + u;
        neuerName = neuerName.trim();
        this.eg.setName(neuerName);
    }
    
}
